package com.example.ontime;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class FormationOpenHelper extends SQLiteOpenHelper{

	
	public FormationOpenHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}
	
	public final static int DATABASE_VERSION = 1;
	public final static String DATABASE_NAME = "Formations.db";
	public final static String FORMATIONS_NAME_TABLE = "formations";
	public final static String EVENT = "événements";
	public final static String ID= "_id";
	
	public static final String FORMATION_TABLE_CREATE =
			 ("CREATE TABLE " + FORMATIONS_NAME_TABLE + "(" + ID + " INTEGER PRIMARY KEY, "+EVENT+" TEXT);");
	
	@Override
	public void onCreate(SQLiteDatabase db) {
		
		db.execSQL(FORMATION_TABLE_CREATE);
		
	}
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		
		db.execSQL("DROP TABLE " + FORMATION_TABLE_CREATE + ";");
		onCreate(db);
		
	}
	
}